package com.bd08.flink.demo.zhang

import org.apache.flink.api.scala.{ExecutionEnvironment, createTypeInformation}

object JoinDemo extends App {
  val benv = ExecutionEnvironment.getExecutionEnvironment
  val ds1=benv.fromCollection(List((1,true),(2,true),(3,false),(4,false)))
  val ds2=benv.fromCollection(List((1,true),(2,false),(3,false),(4,true)))
  //where(0)指定左表ds1的key，位于第一个元素
  //equalTo(0)指定右表ds2的key，位于第一个元素
  ds1.join(ds2).where(0).equalTo(0).print()
  ds1.join(ds2).where(0).equalTo(0).apply(
    (left,right)=>{
      (left._1,(left._2,right._2))
    }
  ).print()

}
